/*
 * ParserView.java
 */

package parser;

import org.jdesktop.application.Action;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import java.io.File;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JFrame;

/**
 * The application's main frame.
 */
public class ParserView extends FrameView {

    public ParserView(SingleFrameApplication app) {
        super(app);
        initComponents();
    }

    @Action
    public void showAboutBox() {
        if (aboutBox == null) {
            JFrame mainFrame = ParserApp.getApplication().getMainFrame();
            aboutBox = new ParserAboutBox(mainFrame);
            aboutBox.setLocationRelativeTo(mainFrame);
        }
        ParserApp.getApplication().show(aboutBox);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainPanel = new javax.swing.JPanel();
        LabelTerminal = new javax.swing.JLabel();
        ScrollTerminal = new javax.swing.JScrollPane();
        ListaTerminal = new javax.swing.JList();
        LabelNoTerminales = new javax.swing.JLabel();
        ScrollNoterminal = new javax.swing.JScrollPane();
        ListaNoTerminal = new javax.swing.JList();
        LabelProduccion = new javax.swing.JLabel();
        ScrollProducciones = new javax.swing.JScrollPane();
        ListaProducciones = new javax.swing.JList();
        LabelSInicial = new javax.swing.JLabel();
        SimbInicial = new javax.swing.JLabel();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        MenuCargar = new javax.swing.JMenuItem();
        MenuGuardar = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        menuAnalizar = new javax.swing.JMenu();
        PrimSig = new javax.swing.JMenuItem();
        tablaParseo = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        CadenaVerif = new javax.swing.JMenuItem();
        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
        ManegadorArchivos = new javax.swing.JFileChooser();

        mainPanel.setName("mainPanel"); // NOI18N

        LabelTerminal.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(parser.ParserApp.class).getContext().getResourceMap(ParserView.class);
        LabelTerminal.setText(resourceMap.getString("LabelTerminal.text")); // NOI18N
        LabelTerminal.setName("LabelTerminal"); // NOI18N

        ScrollTerminal.setName("ScrollTerminal"); // NOI18N

        ListaTerminal.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        ListaTerminal.setName("ListaTerminal"); // NOI18N
        ScrollTerminal.setViewportView(ListaTerminal);

        LabelNoTerminales.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        LabelNoTerminales.setText(resourceMap.getString("LabelNoTerminales.text")); // NOI18N
        LabelNoTerminales.setName("LabelNoTerminales"); // NOI18N

        ScrollNoterminal.setName("ScrollNoterminal"); // NOI18N

        ListaNoTerminal.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        ListaNoTerminal.setName("ListaNoTerminal"); // NOI18N
        ScrollNoterminal.setViewportView(ListaNoTerminal);

        LabelProduccion.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        LabelProduccion.setText(resourceMap.getString("LabelProduccion.text")); // NOI18N
        LabelProduccion.setName("LabelProduccion"); // NOI18N

        ScrollProducciones.setName("ScrollProducciones"); // NOI18N

        ListaProducciones.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        ListaProducciones.setName("ListaProducciones"); // NOI18N
        ScrollProducciones.setViewportView(ListaProducciones);

        LabelSInicial.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        LabelSInicial.setText(resourceMap.getString("LabelSInicial.text")); // NOI18N
        LabelSInicial.setName("LabelSInicial"); // NOI18N

        SimbInicial.setFont(resourceMap.getFont("SimbInicial.font")); // NOI18N
        SimbInicial.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        SimbInicial.setText(resourceMap.getString("SimbInicial.text")); // NOI18N
        SimbInicial.setName("SimbInicial"); // NOI18N

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(ScrollTerminal, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(LabelTerminal, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(ScrollNoterminal, javax.swing.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE)
                    .addComponent(LabelNoTerminales))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(ScrollProducciones)
                    .addComponent(LabelProduccion, javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE))
                .addGap(18, 18, 18)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(SimbInicial, javax.swing.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE)
                    .addComponent(LabelSInicial))
                .addGap(27, 27, 27))
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(LabelTerminal)
                    .addComponent(LabelNoTerminales)
                    .addComponent(LabelProduccion)
                    .addComponent(LabelSInicial))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(ScrollProducciones, javax.swing.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
                    .addComponent(ScrollNoterminal, javax.swing.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
                    .addComponent(ScrollTerminal, javax.swing.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
                    .addComponent(SimbInicial, javax.swing.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE))
                .addContainerGap())
        );

        menuBar.setName("menuBar"); // NOI18N

        fileMenu.setIcon(resourceMap.getIcon("fileMenu.icon")); // NOI18N
        fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
        fileMenu.setName("fileMenu"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(parser.ParserApp.class).getContext().getActionMap(ParserView.class, this);
        MenuCargar.setAction(actionMap.get("cargarArchivo")); // NOI18N
        MenuCargar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.CTRL_MASK));
        MenuCargar.setIcon(resourceMap.getIcon("MenuCargar.icon")); // NOI18N
        MenuCargar.setText(resourceMap.getString("MenuCargar.text")); // NOI18N
        MenuCargar.setName("MenuCargar"); // NOI18N
        fileMenu.add(MenuCargar);

        MenuGuardar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
        MenuGuardar.setIcon(resourceMap.getIcon("MenuGuardar.icon")); // NOI18N
        MenuGuardar.setText(resourceMap.getString("MenuGuardar.text")); // NOI18N
        MenuGuardar.setName("MenuGuardar"); // NOI18N
        fileMenu.add(MenuGuardar);

        jSeparator1.setName("jSeparator1"); // NOI18N
        fileMenu.add(jSeparator1);

        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setIcon(resourceMap.getIcon("exitMenuItem.icon")); // NOI18N
        exitMenuItem.setText(resourceMap.getString("exitMenuItem.text")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        menuAnalizar.setIcon(resourceMap.getIcon("menuAnalizar.icon")); // NOI18N
        menuAnalizar.setText(resourceMap.getString("menuAnalizar.text")); // NOI18N
        menuAnalizar.setName("menuAnalizar"); // NOI18N

        PrimSig.setIcon(resourceMap.getIcon("PrimSig.icon")); // NOI18N
        PrimSig.setText(resourceMap.getString("PrimSig.text")); // NOI18N
        PrimSig.setToolTipText(resourceMap.getString("PrimSig.toolTipText")); // NOI18N
        PrimSig.setName("PrimSig"); // NOI18N
        menuAnalizar.add(PrimSig);

        tablaParseo.setIcon(resourceMap.getIcon("tablaParseo.icon")); // NOI18N
        tablaParseo.setText(resourceMap.getString("tablaParseo.text")); // NOI18N
        tablaParseo.setName("tablaParseo"); // NOI18N
        menuAnalizar.add(tablaParseo);

        jSeparator2.setName("jSeparator2"); // NOI18N
        menuAnalizar.add(jSeparator2);

        CadenaVerif.setIcon(resourceMap.getIcon("CadenaVerif.icon")); // NOI18N
        CadenaVerif.setText(resourceMap.getString("CadenaVerif.text")); // NOI18N
        CadenaVerif.setName("CadenaVerif"); // NOI18N
        menuAnalizar.add(CadenaVerif);

        menuBar.add(menuAnalizar);

        helpMenu.setIcon(resourceMap.getIcon("helpMenu.icon")); // NOI18N
        helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
        helpMenu.setName("helpMenu"); // NOI18N

        aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
        aboutMenuItem.setIcon(resourceMap.getIcon("aboutMenuItem.icon")); // NOI18N
        aboutMenuItem.setText(resourceMap.getString("aboutMenuItem.text")); // NOI18N
        aboutMenuItem.setToolTipText(resourceMap.getString("aboutMenuItem.toolTipText")); // NOI18N
        aboutMenuItem.setName("aboutMenuItem"); // NOI18N
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        ManegadorArchivos.setName("ManegadorArchivos"); // NOI18N

        setComponent(mainPanel);
        setMenuBar(menuBar);
    }// </editor-fold>//GEN-END:initComponents

    @Action
    public void cargarArchivo() {
        ManegadorArchivos = new JFileChooser();
        ManegadorArchivos.setMultiSelectionEnabled(false);
        if(ManegadorArchivos.showOpenDialog(mainPanel) == JFileChooser.APPROVE_OPTION){
            File f = ManegadorArchivos.getSelectedFile();
            System.out.print(f.getAbsolutePath());
        }
        
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem CadenaVerif;
    private javax.swing.JLabel LabelNoTerminales;
    private javax.swing.JLabel LabelProduccion;
    private javax.swing.JLabel LabelSInicial;
    private javax.swing.JLabel LabelTerminal;
    private javax.swing.JList ListaNoTerminal;
    private javax.swing.JList ListaProducciones;
    private javax.swing.JList ListaTerminal;
    private javax.swing.JFileChooser ManegadorArchivos;
    private javax.swing.JMenuItem MenuCargar;
    private javax.swing.JMenuItem MenuGuardar;
    private javax.swing.JMenuItem PrimSig;
    private javax.swing.JScrollPane ScrollNoterminal;
    private javax.swing.JScrollPane ScrollProducciones;
    private javax.swing.JScrollPane ScrollTerminal;
    private javax.swing.JLabel SimbInicial;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JMenu menuAnalizar;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JMenuItem tablaParseo;
    // End of variables declaration//GEN-END:variables

    private JDialog aboutBox;
}
